#include <cstdio>
#include <cstring>

const int Limit_Size = 200 + 5;

int hide[ Limit_Size ][ Limit_Size ], l1, l2;
char str1[ Limit_Size ], str2[ Limit_Size ], fstr[ Limit_Size ];

void init( int step )
{
    int i, j;
    scanf("%s%s%s", str1, str2, fstr);
    l1 = strlen( str1 );
    l2 = strlen( str2 );
    hide[ 0 ][ 0 ] = step;
}

void work( int step )
{
    int i, j;
    for ( i = 0; i <= l1; i++ )
        for ( j = 0; j <= l2; j++ )
        {
            if ( i > 0 )
                if ( hide[ i - 1 ][ j ] == step && str1[ i - 1 ] == fstr[ i + j - 1 ] )
                    hide[ i ][ j ] = step;
            if ( j > 0 )
                if ( hide[ i ][ j - 1 ] == step && str2[ j - 1 ] == fstr[ i + j - 1 ] )
                    hide[ i ][ j ] = step;
        }
}

void print( int step )
{
    printf("Data set %d: ", step);
    if ( hide[ l1 ][ l2 ] == step )
        printf("yes\n");
    else
        printf("no\n");
}

int main( )
{
    int i, t;
    scanf("%d", &t);
    for ( i = 0; i < t; i++ )
    {
        init( i + 1 );
        work( i + 1 );
        print( i + 1 );
    }
    return 0;
}
